package com.gp.service.calculate;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @date: 2017年11月28日
 * @author: 弓成龙
 * @email: gcx909109@sina.cn
 * @description: 返回结果VO
 **/
public class Result implements Serializable{

  private static final long serialVersionUID = 1L;
  private static SimpleDateFormat df = new SimpleDateFormat("yyyy-mm-dd HH:MM:ss");
  // 用户ID
  private Long id;
  // 用户名
  private String name;
  // 创建时间
  private String createTime;
  // 总收入
  private Integer generalIncome;
  // 二级收入
  private Integer secondLevelIncome;
  // 三级收入
  private Integer thirdLevelIncome;
  // 直属收入
  private Integer directIncome;
  // 计算时间周期
  private String calculatePeriod;
  // 二级收入明细
  private List<IncomeDetail> secondLevelIncomeDetail = new ArrayList<IncomeDetail>();
  // 三级收入明细
  private List<IncomeDetail> thirdLevelIncomeDetail = new ArrayList<IncomeDetail>();
  // 直属收入明细
  private List<IncomeDetail> directIncomeDetail = new ArrayList<IncomeDetail>();

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getCreateTime() {
    return createTime;
  }

  public void setCreateTime(String createTime) {
    this.createTime = createTime;
  }


  public String getCalculatePeriod() {
    return calculatePeriod;
  }
  
  public Integer getGeneralIncome() {
    return generalIncome;
  }

  public void setGeneralIncome(Integer generalIncome) {
    this.generalIncome = generalIncome;
  }

  public Integer getSecondLevelIncome() {
    return secondLevelIncome;
  }

  public void setSecondLevelIncome(Integer secondLevelIncome) {
    this.secondLevelIncome = secondLevelIncome;
  }

  public Integer getThirdLevelIncome() {
    return thirdLevelIncome;
  }

  public void setThirdLevelIncome(Integer thirdLevelIncome) {
    this.thirdLevelIncome = thirdLevelIncome;
  }

  public Integer getDirectIncome() {
    return directIncome;
  }

  public void setDirectIncome(Integer directIncome) {
    this.directIncome = directIncome;
  }

  public static long getSerialversionuid() {
    return serialVersionUID;
  }

  public void setCalculatePeriod(String calculatePeriod) {
    this.calculatePeriod = calculatePeriod;
  }

  public List<IncomeDetail> getSecondLevelIncomeDetail() {
    return secondLevelIncomeDetail;
  }

  public void setSecondLevelIncomeDetail(List<IncomeDetail> secondLevelIncomeDetail) {
    this.secondLevelIncomeDetail = secondLevelIncomeDetail;
  }

  public List<IncomeDetail> getThirdLevelIncomeDetail() {
    return thirdLevelIncomeDetail;
  }

  public void setThirdLevelIncomeDetail(List<IncomeDetail> thirdLevelIncomeDetail) {
    this.thirdLevelIncomeDetail = thirdLevelIncomeDetail;
  }

  public List<IncomeDetail> getDirectIncomeDetail() {
    return directIncomeDetail;
  }

  public void setDirectIncomeDetail(List<IncomeDetail> directIncomeDetail) {
    this.directIncomeDetail = directIncomeDetail;
  }

  public IncomeDetail createIncomeDetail(String buyername, Date ordertime,
      String orderCode, int money) {
    return new IncomeDetail(buyername, ordertime, orderCode, money);
  }

  public class IncomeDetail {
    // 订购人
    private String buyername;
    // 订购时间
    private String ordertime;
    // 订单编号
    private String orderCode;
    // 订单总金额
    private Integer money;

    private IncomeDetail(String buyername2, Date ordertime2, String orderCode2,
        Integer money2) {
      this.buyername = buyername2;
      this.money = money2;
      this.orderCode = orderCode2;
      this.ordertime = ordertime2 == null ?  "" : df.format(ordertime2);
    }

    @Override
    public String toString() {
      return "IncomeDetail [buyername=" + buyername + ", ordertime=" + ordertime + ", orderCode="
          + orderCode + ", money=" + money + "]";
    }
    
  }

  @Override
  public String toString() {
    return "Result [id=" + id + ", name=" + name + ", createTime=" + createTime + ", generalIncome="
        + generalIncome + ", secondLevelIncome=" + secondLevelIncome + ", thirdLevelIncome="
        + thirdLevelIncome + ", directIncome=" + directIncome + ", calculatePeriod="
        + calculatePeriod + ", secondLevelIncomeDetail=" + secondLevelIncomeDetail
        + ", thirdLevelIncomeDetail=" + thirdLevelIncomeDetail + ", directIncomeDetail="
        + directIncomeDetail + "]";
  }
  
}
